//
//  AppForClaLeaUpLoadPhoViewController.m
//  AttendenceSys
//
//  Created by ld on 16/1/23.
//  Copyright © 2016年 窦芳俊. All rights reserved.
//

#import "AppForClaLeaUpLoadPhoViewController.h"

@interface AppForClaLeaUpLoadPhoViewController ()

@end

@implementation AppForClaLeaUpLoadPhoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initView];
    
    // Do any additional setup after loading the view.
}

-(void)initView
{
    _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.backgroundColor = [UIColor clearColor];
    _tableView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [_tableView registerClass:[AppForClaLeaUpLoadPhotoCell class] forCellReuseIdentifier:NSStringFromClass([AppForClaLeaUpLoadPhotoCell class])];
    [self.view addSubview:_tableView];
    [self initTabHeadView];
}

-(void)initTabHeadView
{
    UIView* view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 217.5)];
    
    UIImageView* imageHeadView = [[UIImageView alloc] initWithFrame:CGRectMake((self.view.frame.size.width-100)/2, 32.5, 100, 100)];
    [imageHeadView setBackgroundColor:[UIColor clearColor]];
    [imageHeadView setImage:[UIImage imageNamed:@"ic_prove"]];
    [view addSubview:imageHeadView];
    
    UILabel* infoLab = [[UILabel alloc] initWithFrame:CGRectMake((self.view.frame.size.width-200)/2, 152.5, 200, 25)];
    [infoLab setBackgroundColor:[UIColor clearColor]];
    infoLab.font = [UIFont systemFontOfSize:17];
    [infoLab setTextAlignment:NSTextAlignmentCenter];
    infoLab.text = @"请上传学院请假申请证明";
    infoLab.textColor = RGB(102, 102, 102);
    [view addSubview:infoLab];
    
    _tableView.tableHeaderView = view;
}

#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    AppForClaLeaUpLoadPhotoCell* cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([AppForClaLeaUpLoadPhotoCell class])];
    
    if (0 == indexPath.row) {
        cell.infoLab.text = @"从相册上传";
        [cell.photoImage setImage:[UIImage imageNamed:@"ic_album"]];
    }
    if (1 == indexPath.row) {
        cell.infoLab.text = @"拍照上传";
        [cell.photoImage setImage:[UIImage imageNamed:@"ic_picture"]];
    }
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

#pragma mark - UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return UpLoadPhotoCellHeight;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
